n=int(input())
nums=list(map(int,input().split()))
mid=1e9
flag=True
if n%2==0:
    mid=nums[int(n/2)]+nums[int(n/2-1)]
    if mid%2==0:
        mid=int(mid/2)
        flag=False
    else:
        mid/=2
        flag=True
else:
    mid=nums[int(n/2)]
    flag=False

result=[nums[0],nums[-1],mid]

result.sort();
result.reverse()

print(result[0],end=" ")
if flag:
    print("%.1f"%result[1],end=" ")
else:
    print(result[1],end=" ")
print(result[2])

